import React, { Component } from 'react'
import Navbers from '../../Components/Navbers'
import * as actions from '../../redux/axtions/actions'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
export class Search extends Component {
  state = {}
  componentDidMount() {
    this.props.createReqDataAction();
  }
  render() {
    console.log(this.props);
    const { dataArr } = this.props
    return (
      <div className='search_pages'>
        <Navbers></Navbers>
        <div className="bod_box">
          {
            dataArr && dataArr.length ? dataArr.map((item, index) => {
              return (
                <dl key={item.id}>
                  <dt>
                    <img src={item.img} alt="" />
                  </dt>
                  <dd>
                    {item.test}
                  </dd>
                </dl>
              )
            }) : '暂无数据'
          }
        </div>
      </div>
    )
  }
}
const mapStateToProps = (state) => {
  console.log(state);
  const { dataArr } = state.reducer1
  return { dataArr: dataArr }
}
const mapDispatchToProps = (dispatch) => {
  return bindActionCreators(actions, dispatch)
}
export default connect(mapStateToProps, mapDispatchToProps)(Search) 